package com.yuetong.quotation.service.impl;

import java.util.List;

import com.yuetong.common.utils.DateUtils;
import com.yuetong.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yuetong.quotation.mapper.YtQuotationDetailMapper;
import com.yuetong.quotation.domain.YtQuotationDetail;
import com.yuetong.quotation.service.IYtQuotationDetailService;

/**
 * 报价详情明细Service业务层处理
 *
 * @author  卓晓君
 * @date 2025-02-11
 */
@Service
public class YtQuotationDetailServiceImpl implements IYtQuotationDetailService
{
    @Autowired
    private YtQuotationDetailMapper ytQuotationDetailMapper;

    /**
     * 查询报价详情明细
     *
     * @param detailId 报价详情明细主键
     * @return 报价详情明细
     */
    @Override
    public YtQuotationDetail selectYtQuotationDetailByDetailId(Long detailId)
    {
        return ytQuotationDetailMapper.selectYtQuotationDetailByDetailId(detailId);
    }

    /**
     * 查询报价详情明细列表
     *
     * @param ytQuotationDetail 报价详情明细
     * @return 报价详情明细
     */
    @Override
    public List<YtQuotationDetail> selectYtQuotationDetailList(YtQuotationDetail ytQuotationDetail)
    {
        return ytQuotationDetailMapper.selectYtQuotationDetailList(ytQuotationDetail);
    }

    /**
     * 新增报价详情明细
     *
     * @param ytQuotationDetail 报价详情明细
     * @return 结果
     */
    @Override
    public int insertYtQuotationDetail(YtQuotationDetail ytQuotationDetail)
    {
        ytQuotationDetail.setCreatedBy(SecurityUtils.getUsername());
        ytQuotationDetail.setCreatedTime(DateUtils.getNowDate());
        return ytQuotationDetailMapper.insertYtQuotationDetail(ytQuotationDetail);
    }

    /**
     * 修改报价详情明细
     *
     * @param ytQuotationDetail 报价详情明细
     * @return 结果
     */
    @Override
    public int updateYtQuotationDetail(YtQuotationDetail ytQuotationDetail)
    {
        ytQuotationDetail.setUpdatedBy(SecurityUtils.getUsername());
        ytQuotationDetail.setUpdatedTime(DateUtils.getNowDate());
        return ytQuotationDetailMapper.updateYtQuotationDetail(ytQuotationDetail);
    }

    /**
     * 批量删除报价详情明细
     *
     * @param detailIds 需要删除的报价详情明细主键
     * @return 结果
     */
    @Override
    public int deleteYtQuotationDetailByDetailIds(Long[] detailIds)
    {
        return ytQuotationDetailMapper.deleteYtQuotationDetailByDetailIds(detailIds);
    }

    /**
     * 删除报价详情明细信息
     *
     * @param detailId 报价详情明细主键
     * @return 结果
     */
    @Override
    public int deleteYtQuotationDetailByDetailId(Long detailId)
    {
        return ytQuotationDetailMapper.deleteYtQuotationDetailByDetailId(detailId);
    }
}
